//
//  HotServiceCell.m
//  carowner
//
//  Created by apple on 2019/5/21.
//  Copyright © 2019 ggj. All rights reserved.
//

#import "HotServiceCell.h"

@implementation HotServiceCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        _itemBG = [[UIImageView alloc] init];
        _itemBG.backgroundColor = gray_color;
        
        _tvName = [[UILabel alloc] init];
        _tvName.text = @"-";
        _tvName.font = textFont;
        
        _tvShopName = [[UILabel alloc] init];
        _tvShopName.font = textFont;
        _tvShopName.text = @"-";
        
        _orginalPrice = [[UILabel alloc] init];
        _orginalPrice.text = @"原价:";
        _orginalPrice.font = smallFont;
        
        _nowPrice = [[UILabel alloc] init];
        _nowPrice.text = @"¥";
        _nowPrice.font = btnFont;
        _nowPrice.textColor = price_color;
        
        [self addSubview:_itemBG];
        [self addSubview:_tvName];
        [self addSubview:_tvShopName];
        [self addSubview:_orginalPrice];
        [self addSubview:_nowPrice];
        
        [_itemBG mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.equalTo(self).offset(15);
            make.right.equalTo(self).offset(-15);
            make.height.mas_equalTo(120);
        }];
        
        [_tvName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_itemBG.mas_bottom).offset(10);
            make.left.equalTo(_itemBG);
        }];
        
        [_tvShopName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_tvName.mas_bottom).offset(10);
            make.left.equalTo(_itemBG);
        }];
        
        [_orginalPrice mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_tvShopName);
            make.centerX.equalTo(self);
        }];
        
        [_nowPrice mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_tvShopName);
            make.right.equalTo(self).offset(-15);
        }];
        
    }
    return self;
}

@end
